#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5e3 + 10;
const ll MOD = 998244353;

string s;

ll dp[30][N];

ll c[N][N], fac[N], ifac[N];
int cnt[30];

ll qpow(ll a, ll b, int p = MOD) {
    ll res = 1;
    while (b) {
        if (b & 1) res = res * a % p;
        a = a * a % p;
        b >>= 1;
    }
    return res;
}

void init() {
    fac[0] = ifac[0] = 1;
    for (int i = 1; i < N; i++) {
        fac[i] = fac[i - 1] * i % MOD;
        ifac[i] = qpow(fac[i], MOD - 2);
    }
    c[0][0] = 1;
    for (int i = 1; i < N; i++) {
        for (int j = 0; j <= i; j++) {
            c[i][j] = fac[i] * ifac[j] % MOD;
            c[i][j] *= ifac[i - j];
            c[i][j] %= MOD;
        }
    }
}
int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    init();
    cin >> s;
    memset(cnt, 0, sizeof(cnt));
    int n  =s.size();
    for (auto ch : s) cnt[ch-'a']++;

    dp[0][0] = 1;
    for (int i = 0; i < 26; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = 0; k <= min(cnt[i], j); k++) {
                dp[i+1][j] += dp[i][j-k] * c[j][k] % MOD;
                dp[i+1][j] %= MOD;
            }
        }
    }

    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans = (ans + dp[26][i]) % MOD;
    }
    cout << ans << endl;

    return 0;
}
